Fix problems with window positioning
authorMatthias Clasen <matthiasc@src.gnome.org>
Wed, 11 Mar 2009 23:27:07 +0000 (23:27 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 11 Mar 2009 23:27:07 +0000 (23:27 +0000)
svn path=/trunk/; revision=22524

ChangeLog
gtk/gtkentry.c

index c45f5ef09f5e30bdea67b7bce1eaa5b016489df3..c983ad9c7566d31bca177c4c7c696d373818cb47 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-03-11  Matthias Clasen  <mclasen@redhat.com>
+
+       Bug 572455 – GtkEntry window layed out wrong if the widget has focus
+
+       * gtk/gtkentry.c: Fix problems with window positioning. Reported
+       by Benjamin Berg.
+
 2009-03-11  Tor Lillqvist  <tml@iki.fi>
 
        Bug 573067 - Intra-app dnd of text behavior on Windows is wrong
index be1a83e65d0c97b834ccf95c3a1b6eab015cbbfb..607ef878a5656642bb10ebfa15b2c9578c4eb931 100644 (file)
@@ -2265,6 +2265,9 @@ get_icon_allocations (GtkEntry      *entry,
 
   get_text_area_size (entry, &x, &y, &width, &height);
 
+  if (GTK_WIDGET_HAS_FOCUS (entry) && !priv->interior_focus)
+    y += priv->focus_width;
+
   primary->y = y;
   primary->height = height;
   primary->width = get_icon_width (entry, GTK_ENTRY_ICON_PRIMARY);
@@ -2784,7 +2787,6 @@ gtk_entry_size_request (GtkWidget      *widget,
 
 static void
 place_windows (GtkEntry *entry)
-               
 {
   GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (entry);
   gint x, y, width, height;
@@ -2793,9 +2795,11 @@ place_windows (GtkEntry *entry)
   EntryIconInfo *icon_info = NULL;
 
   get_text_area_size (entry, &x, &y, &width, &height);
-
   get_icon_allocations (entry, &primary, &secondary);
 
+  if (GTK_WIDGET_HAS_FOCUS (entry) && !priv->interior_focus)
+    y += priv->focus_width;
+
   if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
     x += secondary.width;
   else
@@ -2803,7 +2807,7 @@ place_windows (GtkEntry *entry)
   width -= primary.width + secondary.width;
 
   if ((icon_info = priv->icons[GTK_ENTRY_ICON_PRIMARY]) != NULL)
-    gdk_window_move_resize (icon_info->window, 
+    gdk_window_move_resize (icon_info->window,
                             primary.x, primary.y,
                             primary.width, primary.height);
 
@@ -2949,7 +2953,7 @@ gtk_entry_size_allocate (GtkWidget     *widget,
       GtkEntryCompletion* completion;
 
       get_widget_window_size (entry, &x, &y, &width, &height);
-      gdk_window_move_resize (widget->window, x, y, width, height);   
+      gdk_window_move_resize (widget->window, x, y, width, height);
 
       place_windows (entry);
       gtk_entry_recompute (entry);
@@ -4010,7 +4014,7 @@ gtk_entry_focus_out (GtkWidget     *widget,
   GtkEntry *entry = GTK_ENTRY (widget);
   GtkEntryCompletion *completion;
   GdkKeymap *keymap;
-  
+
   gtk_widget_queue_draw (widget);
 
   keymap = gdk_keymap_get_for_display (gtk_widget_get_display (widget));